<template>
    <view class="my-page" v-if="isLandscape">
        <view class="key">
            <span class='末'>末</span>
            <span class='日'>日</span>
            <span></span>
            <span class='双'>双</span>
            <span class='人'>人</span>
            <span class='成'>成</span>
            <span class='行'>行</span>
        </view>
        <view class="loading">
            <text>资源加载中...{{loadingNumber}}%</text>
        </view>
        <view class="info">
            抵制不良游戏，拒绝盗版游戏。注意自我保护，谨防受骗上当。适度游戏益脑，沉迷游戏伤身。合理安排时间，享受健康生活。
        </view>
        <view class="info2">
            2024 - 2025 版权所有 © 成都信息工程大学软件2班 www.cuit.com
        </view>
    </view>
    <view class="tip" v-else>
        <text>请将设备旋转到横屏模式以查看内容</text>
    </view>
</template>

<script>
import audioManager from '@/utils/audioManager.js';
export default {
    data() {
        return {
            isLandscape: true,
            loadingNumber: 0
        }
    },
    //当页面加载完成触发
    mounted() {
        this.checkOrientation();
    },
    methods: {
        checkOrientation() {
                audioManager.playAudio('jiazai', false);
                let a = setInterval(() => {
                    this.loadingNumber += Math.floor(Math.random() * 3) + 1;
                    if (this.loadingNumber >= 100) {
                        clearInterval(a);
                        uni.redirectTo({
                            url: "/pages/index/index"
                        })
                    }
                }, 270);
            
        }
    }
}
</script>

<style scoped lang="scss">
@import url(https://fonts.googleapis.com/css?family=Crimson+Text);
@import url('https://fonts.googleapis.com/css2?family=Righteous&display=swap');
$bright : #AFA695;
$gold : #867862;
$dark : #746853;

$duration : 20s;

.tip{
    width: 100%;
    height: 100vh;
    text-align: center;
    line-height: 100vh;
    font-size: 20px;
}

.info{
    position: fixed;
    width: 100%;
    height: 20px;
    bottom: 10px;
    color: #a4aca5;
    text-align: center;
    line-height: 20px;
    font-size: 11px;
}
.info2{
    position: fixed;
    width: 100%;
    height: 20px;
    bottom: 30px;
    color: #a4aca5;
    text-align: center;
    line-height: 20px;
    font-size: 11px;
}
.my-page {
    width: 100%;
    height: 100vh;
    display: flex;
    background: #000;
    overflow: hidden;
}

.key {
    margin: auto;
    perspective: 2000px;
    transform-style: preserve-3d;
    font: 10vw Righteous;
    animation: fade $duration 1; /* 修改为只播放一次 */
}

span {
    position: relative;
    display: inline-block;
    min-width: .5em;
    text-align: center;
    transform-style: preserve-3d;
    transform:  rotateY(25deg);
    animation: rotate $duration 1 ease-in; /* 修改为只播放一次 */
    color: black;
    
    &:after, &:before {
        display: block;
        position: absolute;
        top: 0;
        left: 0;
        content: attr(class);
        color: $gold;
        z-index: -1;
        animation: shadow $duration 1; /* 修改为只播放一次 */
    }
    
    &:before {
        transform: translateZ(-14px);
    }
    &:after {
        transform: translateZ(-7px);
    }
}

@keyframes fade {
    from {
        opacity: 0;
        transform: scale(1.2);
    }
    25% { opacity: 1; }
    100% {
        transform: scale(1);
    }
}

@keyframes rotate {
    from {
        transform: rotateY(65deg);
    }
    50%, 100% {
        color: $dark;
        transform: rotateY(5deg);
    }
    100% {
        color: $gold;
    }
}

@keyframes shadow {
    from {
        color: shade($gold, 50%);
    }
    25% { 
        color: $bright;
    }
    50%, 100% {
        color: tint($gold, 100%);
    }
}

.loading{
    width: 180px;
    height: 30px;
    text-align: center;
    line-height: 30px;
    color: #ff0000;
    z-index: 1;
    position: fixed;
    right: 40%;
    bottom: 60px;
}
</style>